CentOS 6
Sponsored Link

OpenStack Icehouse : Configure Networking
2014/06/23
 
Configure Networking for Virtual Machine Instances.
The follows is for the case you set legacy nova-network in the section [3].
But If you use Neutron Networking, it's unnecessarry to refer to here.
[1] Create a network which instances use in OpenStack internal system.
# nova-manage network create --label (any name) --dns1 (DNS server) --fixed_range_v4=(internal range)

[root@dlp ~(keystone)]#
nova-manage network create --label network01 --dns1 10.0.0.10 --fixed_range_v4=10.1.0.0/24

[root@dlp ~(keystone)]#
nova-manage network list

id   IPv4           IPv6   start address   DNS1        DNS2  VlanID   project  uuid
1    10.1.0.0/24    None   10.1.0.2        10.0.0.10   None  None     None     3bd729ef-
[2] Change default security rules to access to instances with SSH.
# permit SSH

[root@dlp ~(keystone)]#
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp         | 22        | 22      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+

# permit ICMP

[root@dlp ~(keystone)]#
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| icmp        | -1        | -1      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+

[root@dlp ~(keystone)]#
nova secgroup-list-rules default

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp         | 22        | 22      | 0.0.0.0/0 |              |
| icmp        | -1        | -1      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+
OpenStack Icehouse : Set Floating IP
 
It's possible to access to Virtual machine Instance to set Floating IP address.
[3] Change Nova's setting first to assign Floating IP address automatically.
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf
# add follows in the [DEFAULT] section

auto_assign_floating_ip=
true
[root@dlp ~(keystone)]#
/etc/rc.d/init.d/openstack-nova-network restart

Stopping openstack-nova-network:           [  OK  ]
Starting openstack-nova-network:           [  OK  ]
[4] Set Floating IP address. For exmaple, assign 10.0.0.248/29 for Floating IP addresses in internal network 10.0.0.0/24.
[root@dlp ~(keystone)]#
nova-manage floating create --ip_range=10.0.0.248/29

[root@dlp ~(keystone)]#
nova-manage floating list

None    10.0.0.249      None    nova    eth0
None    10.0.0.250      None    nova    eth0
None    10.0.0.251      None    nova    eth0
None    10.0.0.252      None    nova    eth0
None    10.0.0.253      None    nova    eth0
None    10.0.0.254      None    nova    eth0
[5] Create a new instance and boot it, then Floating IP is assgined automatically like follows. In the example below, The "10.0.0.249" is just the Floating IP.
# create and boot Instance

[root@dlp ~(keystone)]#
nova boot --flavor 2 --image CentOS6 --security_group default CentOS_65_Pub

[root@dlp ~(keystone)]#
nova list

+-----------+---------------+---------+------------+-------------+--------------------------------+
| ID        | Name          | Status  | Task State | Power State | Networks                       |
+-----------+---------------+---------+------------+-------------+--------------------------------+
| 7b9e6369- | CentOS_65_Pub | ACTIVE  | -          | Running     | network01=10.1.0.3, 10.0.0.249 |
+-----------+---------------+---------+------------+-------------+--------------------------------+
[6] The Instances created before setting Floating IP, Floating IP does not assigned automatically, so it necessarry to set it manually like follows.
[root@dlp ~(keystone)]#
nova list

+-----------+---------------+---------+------------+-------------+--------------------------------+
| ID        | Name          | Status  | Task State | Power State | Networks                       |
+-----------+---------------+---------+------------+-------------+--------------------------------+
| 1db9260c- | CentOS_65     | SHUTOFF | -          | Shutdown    | network01=10.1.0.2             |
+-----------+---------------+---------+------------+-------------+--------------------------------+

# assign "10.0.0.250" to "CentOS_65"

[root@dlp ~(keystone)]#
nova add-floating-ip CentOS_65 10.0.0.250

[root@dlp ~(keystone)]#
nova list

+-----------+---------------+---------+------------+-------------+--------------------------------+
| ID        | Name          | Status  | Task State | Power State | Networks                       |
+-----------+---------------+---------+------------+-------------+--------------------------------+
| 1db9260c- | CentOS_65     | SHUTOFF | -          | Shutdown    | network01=10.1.0.2, 10.0.0.250 |
+-----------+---------------+---------+------------+-------------+--------------------------------+
 
Tweet